#!/bin/bash

#设置远程维护软件开机自启动
rm /lib/systemd/system/xzrobot_station.service
echo "#  SPDX-License-Identifier: LGPL-2.1+
#
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.

# This unit gets pulled automatically into multi-user.target by
# systemd-rc-local-generator if xzrobot_station is executable.
[Unit]
Description=xzrobot_station
After=multi-user.target

[Service]
User=xzrobot

ExecStart=/usr/bin/python /opt/xzrobot/xzrobot_station/server.py
#Type=forking
#RestartSec=5

[Install]  
WantedBy=multi-user.target" >> /lib/systemd/system/xzrobot_station.service

chmod 777 /lib/systemd/system/xzrobot_station.service

systemctl enable xzrobot_station
systemctl start xzrobot_station